<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="所在单位">
              <j-select-depart v-model="queryParam.comId" :trigger-change="true" customReturnField="id"
                               :multi="true"></j-select-depart>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="疑点名称">
              <a-input style="width: 100%" placeholder="请输入" v-model="queryParam.ydmc"/>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">清除条件</a-button>
            </span>
            <!-- 操作按钮区域 -->
            <div class="table-operator">
              <a-button
                type="primary"
                style="padding: 0 10px; margin-left: 10px; background-color: #ffa500; border: 1px solid #ffa500"
                @click="onYdView"
              >疑点列表
              </a-button
              >
            </div>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      >
        <span slot="actionName">
          <a-button size="small" @click="handleAdd('风险管理-新增')" v-has="'risk:add'"
                    type="primary" icon="plus">新增</a-button>
        </span>
        <span slot="action" slot-scope="text, record">
          <span v-has="'risk:detail'">
            <a @click="handleCheck(record, '风险管理-查看')" >查看</a>
            <a-divider type="vertical"/>
          </span>
          <a @click="handleEdit(record, '风险管理-编辑')" v-has="'risk:edit'">编辑</a>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <CheckAndEditModel ref="modalForm" @ok="modalFormOk"></CheckAndEditModel>
    <ydView ref="ydView" @ok="modalFormOk"></ydView>
  </a-card>
</template>

<script>
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import CheckAndEditModel from './CheckAndEditModel'
  import columns from './indexColumns'
  import ydView from './ydView'

  export default {
    name: 'fxgl',
    mixins: [JeecgListMixin],
    components: {
      CheckAndEditModel,
      ydView
    },
    data() {
      return {
        queryParam: {},
        // 表头
        columns: columns(this),
        url: {
          list: '/sjcg/sjWorkZtfaEveRisk/getRiskList',
          delete: '/sjcg/sjWorkZtfaEveRisk/delete'
        },
      }
    },
    created() {
    },
    methods: {
      onYdView() {
        this.$refs.ydView.visible = true
      },
    },
  }
</script>

<style scoped>
  @import '~@assets/less/common.less';
</style>